package com.alibaba.cloud.client8081.config;

import com.alibaba.cloud.client8081.service.IndexFeignService;
import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;
@Component
public class IndexFeignFallback implements FallbackFactory<IndexFeignService> {

    @Override
    public IndexFeignService create(Throwable throwable) {
        return new IndexFeignService() {
            @Override
            public Integer getPort(Map<String, Object> param) {
                //根据异常类型，返回流控还是降级
                
                if (throwable instanceof FlowException) {

                }
                return null;
            }

            @Override
            public Integer postPort(Map<String, Object> param) {
                return null;
            }

            @Override
            public Integer param(String name) {
                return null;
            }
        };
    }
}
